package com.jhx.mall.dao.impl;

import com.jhx.mall.dao.BaseDao;
import com.jhx.mall.dao.DtsIssueDao;
import com.jhx.mall.entity.DtsIssue;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class DtsIssueDaoImpl extends BaseDao implements DtsIssueDao {
    @Override
    public List<DtsIssue> selectIssueAll() {
        List<DtsIssue> dtsIssueList = new ArrayList<>();
        String sql = "select id, question, answer, add_time, update_time, deleted from dts_issue where deleted = 0";
        rs = executeQuery(sql);
        try {
            while (rs.next()) {
                DtsIssue dtsIssue = new DtsIssue();
                dtsIssue.setId(rs.getLong("id"));
                dtsIssue.setQuestion(rs.getString("question"));
                dtsIssue.setAnswer(rs.getString("answer"));
                dtsIssue.setAddTime(rs.getString("add_time"));
                dtsIssue.setUpdateTime(rs.getString("update_time"));
                dtsIssue.setDeleted(rs.getLong("deleted"));
                dtsIssueList.add(dtsIssue);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return dtsIssueList;
    }
}
